package com.c4p.store;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.time.Duration;

@Component
public class RedisStore implements IStore{

    @Autowired
    RedisTemplate redisTemplate;


    @Override
    public void put(String key, Object clazzCompiled) {
        this.redisTemplate.opsForValue().set(key, clazzCompiled, Duration.ofHours(2));
    }

    @Override
    public Object get(String key) {
        return this.redisTemplate.opsForValue().get(key);
    }
}
